package dungeon;

import dungeonElements.Square;


/**
 * A dungeon that expands in only 2 dimensions. It always has a Z size of 1.
 * The X and Y sizes can be anything a normal dungeon is allowed to have.
 * 
 * @invar The Z size is 1
 * 			|this.getZSize() == 1;
 * @author Tom Jacobs & Ewoud De Moor
 * @version 3.0
 */
public class Level<E extends Square> extends Dungeon<E> {

	/**
	 * Creates a new Level with size (xSize, zSize, 1).
	 * 
	 * @param xSize
	 * 			The size of this Level in the X-direction
	 * @param ySize
	 * 			The size of this Level in the Y-direction
	 * @throws IllegalArgumentException
	 * 			xSize and ySize must both be positive
	 * 			|(xSize < 1) || (ySize < 1)
	 */
	public Level(long xSize, long ySize)
			throws IllegalArgumentException {
		if((xSize < 1) || (ySize < 1))
			throw new IllegalArgumentException("Sizes must be positive");
		setXSize(xSize);
		setYSize(ySize);
		setZSize(1);
	}
	
	/**
	 * Check if this level can have the given size as its size.
	 *
	 * @param xSize
	 * 		The xSize to check.
	 * @param ySize
	 * 		The ySize to check.
	 * @param zSize
	 * 		The zSize to check.
	 * @return False if this dungeon can't have the new size.
	 * 		| if(!super.canHaveAsSize(xSize, ySize, zSize))
	 * 		|	then result == false
	 * @return A zSize other than 1 is not allowed. A level has only 2 dimensions.
	 * 		| if( zSize != 1 )
	 * 		|	then result == false
	 */
	@Override
	public boolean canHaveAsSize(long xSize, long ySize, long zSize){
		if(!super.canHaveAsSize(xSize, ySize, zSize))
			return false;
		if( zSize != 1 )
			return false;
		return true;
	}
}
